home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / raid / devRaidDisk.h < prev    next >
C/C++ Source or Header  |  1990-11-09  |  2KB  |  57 lines

  1. /*
  2.  * devRaidDisk.h --
  3.  *
  4.  *    Declarations of ...
  5.  *
  6.  * Copyright 1989 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  *
  15.  * $Header: /sprite/src/kernel/raid/RCS/devRaidDisk.h,v 1.6 90/11/09 13:15:54 eklee Exp $ SPRITE (Berkeley)
  16.  */
  17.  
  18. #ifndef _DEVRAIDDISK
  19. #define _DEVRAIDDISK
  20.  
  21. #include "devRaid.h"
  22. #include "semaphore.h"
  23.  
  24. /*
  25.  * Data structure for each disk used by raid device.
  26.  *
  27.  * RAID_DISK_INVALID    ==> could not attach device
  28.  * RAID_DISK_READY    ==> device operational
  29.  * RAID_DISK_FAILED    ==> device considered failed (a write error occured)
  30.  * RAID_DISK_REPLACED    ==> the device is nolonger a part of the array
  31.  * RAID_DISK_RECONSTRUCT==> the device is currently being reonstructed
  32.  *                (IO's to the reconstructed part of the device
  33.  *                 are allowed)
  34.  */
  35. typedef enum {
  36.     RAID_DISK_INVALID, RAID_DISK_READY, RAID_DISK_FAILED, RAID_DISK_REPLACED,
  37. } RaidDiskState;
  38.  
  39. typedef struct RaidDisk {
  40.     Sema           lock;
  41.     RaidDiskState      state;
  42.     unsigned          numValidSector; /* Used during reconstruction. */
  43.     int              row;
  44.     int              col;
  45.     int              version;
  46.     Fs_Device              device;
  47.     DevBlockDeviceHandle *handlePtr;
  48. } RaidDisk;
  49.  
  50. /*
  51.  * Is specified range of disk sectors "valid" on specified disk? 
  52.  */
  53. #define IsValid(diskPtr, startSector, numSector)     \
  54.     ((startSector) + (numSector) <= (diskPtr)->numValidSector)
  55.  
  56. #endif _DEVRAIDDISK
  57.